package com.study.ssm;

import com.study.ssm.injection.InjectionService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * <pre>
 *     project name: SpringStudy
 *     author      : 李琼
 *     e-mail      : 1265137718@qq.com
 *     create time : 2017/9/5 上午12:25
 *     desc        : 描述--//SpringDemo TODO
 *     URL         : CSDN:http://blog.csdn.net/qq_22945151
 *                   GitHub:https://github.com/a1265137718
 *     Reference   ://
 *     modifier               :
 *     modification time      :
 *     modify remarks         :
 *
 *     @version: --//TODO
 * </pre>
 */


public  class SpringDemo {
    public static void main(String[] args) {

        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");//根据spring的配置文件名
        //获取到bean节点下id = helloworld下的类 ，成员变量的值value = message 在xml中被赋值为Hello World!
        MessageGet helloworld = (MessageGet) context.getBean("MessageGet");
        System.out.println(helloworld.getMessage());

        ClassPathXmlApplicationContext contextInjection = new ClassPathXmlApplicationContext("./resources/spring-injection.xml");
        InjectionService injectionService = (InjectionService) contextInjection.getBean("injectionService");
        injectionService.save("这是在main方法中获取的injectionService对象");
    }
}
